//****************************************************************
//* Copyright (c) 2004 Ford Motor Company. All Rights Reserved.
//*
//* $$Workfile:   CatalogSFIDao.java  $$
//* $$Revision:   1.0  $$
//* $$Author:   TMALDON4  $$
//* $$Date:   Mar 30 2009 13:57:52  $$
//*
//*****************************************************************
package ar.com.ford.it.fullEconomics.persistence.dao;

import java.sql.Timestamp;
import java.util.Collection;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas003ColorVw;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas101CatalogVw;
import ar.com.ford.it.fullEconomics.persistence.dto.Ncas109CatasfiVw;
import ar.com.ford.it.webengine.persistence.PersistenceUtil;
import com.ford.it.logging.ILogger;
import com.ford.it.logging.LogFactory;
import com.ford.it.persistence.PersistenceException;
import com.ford.it.persistence.PersistenceManager;
import com.ford.it.persistence.Query;

public class CatalogSFIDao extends Dao {

	private static final String CLASS_NAME = CatalogSFIDao.class.getName();

	private static final ILogger log = LogFactory.getInstance().getLogger(
			CLASS_NAME);

	/**
	 * Suma los usos de una misma Part, agrupando por catalogo, obteniendo el
	 * total de piezas usadas
	 * 
	 * @return
	 * @throws PersistenceException
	 */
	public Collection<Ncas109CatasfiVw> findCatalogSFIByDateColor(
			Timestamp fechaSFIInicio, Timestamp fechaSFIFin, Ncas101CatalogVw catalog,
			Ncas003ColorVw color) throws PersistenceException {

		String METHOD_NAME = "findCatalogSFIByDateColor";
		log.entering(CLASS_NAME, METHOD_NAME);

		Collection<Ncas109CatasfiVw> resultCol = null;
		PersistenceManager pm = null;

		pm = PersistenceUtil.getPersistenceManager();
		Query query = pm.newQuery("findCatalogSFIByDateColor",
				Ncas109CatasfiVw.class);

		Object[] parametros = { fechaSFIInicio, fechaSFIFin, catalog, color };

		query.setParameterArray(parametros);

		resultCol = (Collection) pm.executeQuery(query);

		log.exiting(CLASS_NAME, METHOD_NAME);
		return resultCol;
	}

}
